package com.miyake.client.tools;

import java.util.List;

import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.Image;
import com.miyake.client.datamanage.NodeProperty;

public class ImageListDialog extends ItemListDialog {

	public ImageListDialog(String nodeKey) {
		super(nodeKey);
	}

	@Override
	protected void getContentList(String nodeKey) {
		service.getImageList(nodeKey, new AsyncCallback<List<NodeProperty>>() {
			@Override
			public void onFailure(Throwable caught) {
			}

			@Override
			public void onSuccess(List<NodeProperty> result) {
				showList(result);
			}
		});
	}

	@Override
	protected void getContent(String key, final Image image) {
		service.getImage(key, new AsyncCallback<String>() {
			@Override
			public void onFailure(Throwable caught) {
			}

			@Override
			public void onSuccess(String result) {
				image.setSize("200px", "100px");
				image.setUrl(result);
			}
		});
	}

}
